package de.zefania.api.builder;

import java.io.File;
import java.util.HashMap;

import de.zefania.api.DictionaryModul;
import de.zefania.api.ModulInformation;
import de.zefania.api.Position;

public abstract class DictionaryBuilder {	
	public enum ModulType { DICTIONARY, COMMENTARY, STRONG, DAILY }		
	
	protected DictionaryModul modul;

	
	/**
	 * creates an empty valid Zefania XML Modul
	 * @param file - the file where the modul will be stored in
	 */
	public abstract void createEmptyModul(File file);
	
	/**
	 * sets the revision number of this modul (not of the translation!)
	 * @param revision
	 */
	public abstract void setRevision(int revision);	
	
	/**
	 * sets the type of this modul
	 * @param type
	 * @see ModulType
	 */
	public abstract void setType(ModulType type);
	
	/**
	 * set the referenced Bible of this Dictionary
	 * @param refBible
	 */
	public abstract void setRefBible(String refBible);
	
	/**
	 * sets the location of the schema definition
	 * @param schemaLocation
	 */
	public abstract void setSchemaLocation(String schemaLocation);
	
	/**
	 * set the version of the schema definition
	 * @param schemaVersion
	 */
	public abstract void setSchemaVersion(String schemaVersion);
	
	/**
	 * sets the children of the &lt;INFORMATION&gt;-Element
	 * @param information
	 */
	public abstract void setInformation(HashMap<String, String[]> information);
	
	/**
	 * sets the children of the &lt;INFORMATION&gt;-Element
	 * @param information
	 */
	public abstract void setInformation(ModulInformation information);
	
	/**
	 * creates an empty dictionary item
	 * @param id
	 */
	public abstract void appendEmptyDictItem(String id);
	
	/**
	 * appends the description of a dictionary item.
	 * <p>
	 * if the id doesn't exist in the modul it will be created 
	 * otherwise the description is appended to the item
	 * @param id a unique identifier, here that is the word, which the entry describes
	 * @param hStrong the hebrew Strong number
	 * @param gStrong the greek Strong number
	 * @param title the title of the entry
	 * @param pos a list of verses, where the id appears
	 * @param targetIds a list of ids, that have a similar topic
	 */
	public abstract void appendDictItemDescription(String id, int hStrong, int gStrong, 
			String title, Position[] pos, String[] targetIds);
	
	/**
	 * appends a commentary item to the modul
	 * @param id a unique identifier
	 * @param pos the position of the bible text this item is related to
	 * @param description a text about the bible text
	 */
	public abstract void appendCommentaryItem(String id, Position pos, String description);
		
	/**
	 * returns the built DictionaryModul
	 * @return DictionaryModul object
	 */
	public final DictionaryModul getModul() {
		return modul;
	}
	
	/**
	 * saves the created modul to the hard disk
	 */
	public abstract void saveToDisk();
	
}
